#ifndef VOTER_H 
#define VOTER_H 1

#if defined (__cplusplus)
  extern "C"
  {
#endif

#ifndef EXTERN
#ifdef MAIN
#define EXTERN
#else
#define EXTERN extern
#endif
#endif

#include <stdlib.h>

#include "ApmsUtilityInt.h"
#include "InfiApi.h"
#include "ApmsApi.h"
//#include "Mmi1090.h"
#include "Tianwan.h"
#include "Mov_Tianwan.h"


// Main-function

#define VOTER() ( PASCAL WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, \
                          LPSTR lpCmdLine, int nCmdShow ) )
#define IsApmsRunning()	(GetApmsInfo( SYI_IsSystemActive ))
RETCOND LogAddMsg( char *szMessageText, char *szFileName );
RETCOND LogReset( char *szFileName );
RETCOND Init_Table(int *iVotedConf);
RETCOND Find_pts( char *nome_pts, float *val_ana, unsigned long *val_dig, int *stato);
RETCOND Mov_In_Prog( TAGNAME Movinprog, int indice, int *is_Movinprog);
RETCOND LookForTripIdx(TAGNAME tripTag, int *tripIdx);

// General process definitions
#define LOG				_TEXT("Log_Voter.txt")
#define	CYCLE			200
#define SEL_COUNT		800
#define SEL_COUNT_MAN	800
#define ANG_DEF_DEV		10.0
#define FORCED_INIT		2

DWORD dwOption_Infi = TAGWRITE_TOOUTPUT;
DWORD dwOption_Rtdb = TAGWRITE_DIRECT;
DWORD dwOption_Std  = TAGWRITE_STD;
typedef struct {
	TAGIDX		idx_pto_C;
	TAGNAME		name;
	TAGVAL		TagVal;
	int			tipo_punto;
	TIME1090	Tnt_Time;
	TAGIDX		idx_pto_trip;
	TAGNAME		Trip_Point;
	TAGIDX		idx_mov_type;
	TAGNAME		Movement_Type;
	TAGIDX		idx_pto_interbl;
	TAGNAME		Interbl_Point;
	int			Wait_Time;
	int			First_run;
	float		sca_vl_100;
	float		sca_vl_0;
	TAGIDX		idx_pto_A;
	TAGNAME		name_pto_A;
	TAGVAL		TagVal_pto_A;
	TAGIDX		idx_pto_B;
	TAGNAME		name_pto_B;
	TAGVAL		TagVal_pto_B;
	short		i_sel_cont;
	DWORD		dwStartError;	
	bool		tripEnabled;
	float		abs_dev;	
	bool		enabled;
	int			forced;
} TABLE_PTS, *LPT_TABLE_PTS;
  // Member variables.

// END of header VOTER.H
#if defined (__cplusplus)
}
#endif

#endif